package Scuttlebutt;

import java.awt.event.*;
import javax.swing.*;
import glue.*;
import java.io.*;
import javax.swing.tree.DefaultMutableTreeNode;
import java.util.Enumeration;
import glue.ftp.*;

public class EventOpenProject extends JMenuItem implements ActionListener 
{
	Scuttlebutt parent = null;
	
	
	public EventOpenProject(Scuttlebutt parent)
	{
		this.parent = parent;
		addActionListener(this);
	}
	
	
	public EventOpenProject(String text, Scuttlebutt parent)
	{
		super(text);
		this.parent = parent;
		addActionListener(this);
	}

	public void actionPerformed(ActionEvent a0)
	{
		JFileChooser chooser = new JFileChooser();
		chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
		chooser.addChoosableFileFilter(new SuperFileFilter(new String("prj")));
		if(chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION){
			File selectedFile = chooser.getSelectedFile();
			parent.loadProject(selectedFile);		
		}	
	}
}

